<?php

namespace app\common\validate;

use think\Validate;

class CartValidate extends Validate
{
	/**
	 * 验证规则
	 * @var [array]
	 */
	protected $rule = [
        'id|购物车表id' => 'require',
       	'goodsProId|商品详情id' => 'require',
       	'number|数量' => 'require'
    ];

    /**
     * 添加
     * @Author   Yichen
     * @DateTime 2020-05-04T17:37:59+0800
     * @return   [type]                   [description]
     */
    public function sceneAdd()
    {
        return $this->only(['goodsProId', 'number']);
    }

    /**
     * 删除
     * @Author   Yichen
     * @DateTime 2020-05-13T22:28:18+0800
     * @return   [type]                   [description]
     */
    public function sceneDel()
    {
        return $this->only(['id']);
    }

    /**
     * 加减
     * @Author   Yichen
     * @DateTime 2020-05-13T23:07:13+0800
     * @return   [type]                   [description]
     */
    public function scenePutQty()
    {
        return $this->only(['id', 'number']);
    }
}